Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@hyurl/utils

Package Overview
Dependencies
Maintainers
1
Versions
71
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@hyurl/utils

Utility functions of HyURL collection.

  • 0.2.26
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
138
decreased by-33.01%
Maintainers
1
Weekly downloads
 
Created
Source

HyURL Utilities

Utility functions of HyURL collection.

This package currently contains the following functions, more functions may be included in the future. Each function is stored in a separated file.

Since 0.1.50, this package now supports Node.js, Web and Deno.

  • count.d.ts
  • define.d.ts
  • diff.d.ts
  • ensureType.d.ts
  • flatObject.d.ts
  • getGlobal.d.ts
  • isBetween.d.ts
  • isEmpty.d.ts
  • isFloat.d.ts
  • isInteger.d.ts
  • isNumeric.d.ts
  • isOwnKey.d.ts
  • isOwnMethod.d.ts
  • isSubClassOf.d.ts
  • isVoid.d.ts
  • keysOf.d.ts
  • omit.d.ts
  • omitVoid.d.ts
  • patch.d.ts
  • pick.d.ts
  • rand.d.ts
  • randStr.d.ts
  • sleep.d.ts
  • sort.d.ts
  • split.d.ts
  • timestamp.d.ts
  • trim .d.ts
  • typeAs.d.ts
  • typeOf.d.ts
  • until.d.ts
  • useThrottle.d.ts
  • wrap.d.ts

Import

There are two ways to import these functions.

All At Once

This method will load all functions into memory, even if you don't need some of them.

import * as utils from "@hyurl/utils";

// or import specific functions

import { count, ensureType } from "@hyurl/utils";

Only Needed

This method will only load needed functions, which is recommended.

import count from "@hyurl/utils/count";
import ensureType from "@hyurl/utils/ensureType";

Utilities Types

Other than utility functions, this package also provides some utility types for TypeScript, they are located in the following file and exposed to the global namespace.

import "@hyurl/utils/types";

Web Support

When using this package in the browser, there are three ways to import this package.

  1. Import From node_modules

This is the same as above, but requires a module bundler such as webpack.

  1. Load ES Module
<script type="module">
    import utils from "https://github.com/hyurl/utils/raw/master/esm/index.js";
    // Note the difference with the TypeScript/CommonJS version.
</script>

Note: this module can also be used Node.js as well.

Load Bundle

<script src="https://github.com/hyurl/utils/raw/master/bundle/index.js"></script>
<script>
    const { count } = window["@hyurl/utils"];

    console.log(count([1,2,3]));
<script>

Deno Support

Yes, this package can be used directly in Deno, to use it, there are two ways to import:

  1. Directly from GitHub (recommended):
import * as utils from "https://github.com/hyurl/utils/raw/master/mod.ts";
  1. Via Deno hosting service:
import * as utils from "https://deno.land/x/hyurl_utils/mod.ts";

Unit Test

In Node.js

npm test

In Deno

npm run test-deno
# or
deno test test/deno/example.ts

Keywords

FAQs

Package last updated on 28 Nov 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc